<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
<include file="Public/common_header" />

<div class="mian">
    <div class="mianL">
        <include file="Public/sidebar" menu="jybggl.bgd"/>
    </div>
        <div class="mianR">
            <h3 class="yonghu">变更单基本信息</h3>
 			<div class="arbitration">
 				<table>
 					<tbody>
 						<tr><td>车辆名称</td><td colspan="3">{$res.model}</td></tr>
 						<tr><td>拍单号</td><td>{$res.order_no}</td><td>车牌号</td><td>{$res.car_plate_number}</td></tr>
 						<tr><td>拍单变更单号</td><td>{$res.modify_no}</td><td>车商信息</td><td>{$res.contact_person}：{$res.contact_mobile}</td></tr>
 						<tr><td>变更原因</td><td>{$modify_reason[$res['modify_reason']]}</td><td>车主信息</td><td>{$res.seller_name}：{$res.phone}</td></tr>
 						<tr><td>变更状态</td><td>{$modify_status[$res['status']]}</td><td>变更时间</td><td>{$res.createtime}</td></tr>
 						<tr><td>变更描述</td><td colspan="3" style="padding:0 10px; text-align: left;">{$res.modify_desc}</td></tr>
 						<!-- <tr><td>车辆是否退回</td><td colspan="3" style="padding:0 10px; text-align: left;">
                        <?php if ($res['modify_result'] == 2): ?>
                        是
                        <?php elseif ($res['modify_result'] == 1) : ?>
                        否
                        <?php endif ?>
                        </td></tr> -->
 					</tbody>
 				</table>
 			</div>
 			<h3 class="yonghu">车商处置信息</h3>
 			<div class="arbitration">
 				<table>
 					<thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
 					<tbody>
 						<tr>
                            <td width="20%">拍单号：{$res.order_no}</td>
                            <td width="30%"><span>应收车款：{$res.final_price}元</span><span>实收车款：{$res.real_collection}元</span></td>
                            <td width="30%">
                                <?php if ($res['modify_result'] ==2): ?>
                                    应退车款：{$res.real_collection}元
                                <?php endif ?>
                            </td>
                            <td width="20%"></td>
                        </tr>
 						<tr>
                            <td>赔款</td>
                            <td></td>
                            <td>{$res.dealer_compensate}元</td>
                            <td></td>
                        </tr>
 						<tr>
                            <td>违约扣款</td>
                            <td></td>
                            <td></td>
                            <td>{$res.dealer_deduction}元</td>
                        </tr>
 						<tr>
                            <td>小计</td>
                            <td></td>
                            <td>
                            <?php if ($res['modify_result'] ==2): ?>
                                <?php echo $res['real_collection']+$res['dealer_compensate']; ?>
                            <?php else: ?>
                                <?php echo $res['dealer_compensate']; ?>
                            <?php endif ?>
                            元</td>
                            <td>{$res.dealer_deduction}元</td>
                        </tr>
 					</tbody>
 				</table>
                <?php if ($res['modify_result'] ==2): ?>
                     <?php if (($res['real_collection']+$res['dealer_compensate']-$res['dealer_deduction'])>=0): ?>
                        <div class="financial">财务付款:<?php echo abs($res['real_collection']+$res['dealer_compensate']-$res['dealer_deduction']); ?>元</div>
                    <?php else: ?>
                        <div class="financial">财务收款:<?php echo abs($res['real_collection']+$res['dealer_compensate']-$res['dealer_deduction']); ?>元</div>
                    <?php endif ?>
                <?php else: ?>
                        <div class="financial">财务付款:<?php echo abs($res['dealer_compensate']-$res['dealer_deduction']); ?>元</div>
                <?php endif ?>
               
               
 			</div>
            <?php if ($res['source'] > 7): ?>
                <h3 class="yonghu">车主处置信息</h3>
                <div class="arbitration">
                    <table>
                        <thead><tr><td>关联单据</td><td>费用项</td><td>退/赔项</td><td>收扣款项</td></tr></thead>
                        <tbody>
                            <tr>
                                <td width="20%">采购单号：{$res.purchase_order_nu}</td>
                                <td width="30%"><span>应付车款：{$res.success_price}元</span><span>实付车款：{$res.real_payment}元</span></td>
                                <td width="30%"></td>

                                <td width="20%">
                                <?php if ($res['modify_result'] ==2): ?>
                                    收回车款：{$res.real_payment}元
                                <?php endif ?>
                                </td>
                            </tr>
                            <tr>
                                <td>赔款</td>
                                <td></td>
                                <td>{$res.owner_compensate}元</td>
                                <td></td>
                            </tr>
                            <tr>
                                <td>违约扣款</td>
                                <td></td>
                                <td></td>
                                <td>{$res.owner_deduction}元</td>
                            </tr>
<!--                             <tr><td>小计</td><td colspan="2"></td><td></td></tr> -->
                        <tr>
                            <td>小计</td>
                            <td></td>
                            <td>{$res.owner_compensate}元</td>
                            <td>
                            <?php if ($res['modify_result'] ==2): ?>
                                <?php echo $res['real_payment']+$res['owner_deduction']; ?>
                            <?php else: ?>
                                <?php echo $res['owner_deduction']; ?>
                            <?php endif ?>
                            元
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <?php if ($res['modify_result'] ==2): ?>
                        <?php if (($res['real_payment']-$res['owner_compensate']+$res['owner_deduction'])>=0): ?>
                            <div class="financial">财务收款:<?php echo abs($res['real_payment']-$res['owner_compensate']+$res['owner_deduction']); ?>元</div>
                        <?php else: ?>
                            <div class="financial">财务付款:<?php echo abs($res['real_payment']-$res['owner_compensate']+$res['owner_deduction']); ?>元</div>
                        <?php endif ?>
                    <?php else: ?>
                            <div class="financial">财务付款:<?php echo abs($res['owner_deduction']-$res['owner_compensate']); ?>元</div>
                    <?php endif ?>
                </div>
            <?php endif ?>
            <?php if ($res['buyer_card_no'] !='' || $res['buyer_bank_name'] !=''||$res['buyer_account_name'] !='' ): ?>
                <h3 class="yonghu">付款账号信息(买家)</h3>
                <div class="finance">
                    <dl class="finance-right clearfix">
                        <dt>开户名：</dt><dd>{$res.buyer_account_name}</dd>
                        <dt>银行帐号：</dt><dd>{$res.buyer_card_no}</dd>
                        <dt>银行名称：</dt><dd>{$res.buyer_bank_name}</dd>
                    </dl>
                    <div class="clear"></div>
                </div>
            <?php endif ?>
 			<?php if ($res['seller_card_no'] !='' || $res['seller_bank_name'] !=''||$res['seller_account_name'] !='' ): ?>
                <h3 class="yonghu">付款账号信息(卖方)</h3>
                <div class="finance">
                    <dl class="finance-right clearfix">
                        <dt>开户名：</dt><dd>{$res.seller_account_name}</dd>
                        <dt>银行帐号：</dt><dd>{$res.seller_card_no}</dd>
                        <dt>银行名称：</dt><dd>{$res.seller_bank_name}</dd>
                    </dl>
                    <div class="clear"></div>
                </div>
            <?php endif ?>
            
            <?php if ($res['modifylist_log']): ?>
                <h3 class="yonghu">变更单操作日志</h3>
                <div class="yonghuText">
                    <ul>
                        <php>$confirm_logs = array('1'=>'发起','2'=>'提交','3'=>'完成','4'=>'拒绝','5'=>'作废')</php>
                        <?php foreach ($res['modifylist_log'] as $key => $value): ?>
                            <li class="{$k%2==0?'xitongBg':''} clearfix">
                                <em>{$value.createtime}</em>
                                <em>{$value.real_name}</em>
                                <em>{$confirm_logs[$value['desc']]}</em>
                            </li>
                        <?php endforeach ?>
                    </ul>
                </div>
            <?php endif ?> 
            <div class="yongBtn clearfix" >
                <?php if ($res['is_valid'] == 1): ?>
                    <input class="queding" type="submit" value="作废" onclick="modifylist_cancel({$res.mid});">
                    <!-- <input class="quxiao" type="submit" value="拒绝执行" onclick="refuse_execute({$res.mid});"> -->
                <?php else: ?>
                    <input class="quxiao" type="submit" value="关闭" onclick="window.close();">
                <?php endif ?>
            </div>
 			<!-- <div class="amount-receivable"><span>应收金额：</span>50000万</div> -->
        </div>
    <div class="clear"></div>
<div class="yunBei"></div>
</div>
<script>
    function modifylist_cancel(mid){
        confirm_alert('<div style="color:red">您确定要变更单作废吗</div>', function () {
            $(".determine").on('click', function () {
                var param = {
                    'mid':mid
                };
                var btn_obj = $(this);
                btn_obj.val("提交中...").attr("disabled",'disabled');
                $.post('/changeOrder/modifylist_cancel', param, function (data) {
                    if (data.code == '200') {
                        btn_alert(data.msg);
                        setTimeout(function () {
                            btn_obj.val("确定").removeAttr("disabled style");
                            colse_hide();
                            window.opener.location.href = window.opener.location.href;
                            window.close();  
                        }, 400);
                    } else {
                        shibai_alert(data.msg, 500, function(){
                            colse_hide();
                        });
                        btn_obj.val("确定").removeAttr("disabled style");
                    }
                }, 'json');
            });
        })
    }

</script>
</body>
</html>